package response

//错误码
const (
	SUCCESS                    = 0     //成功
	BadRequest                 = 400   //请求失败
	Unauthorized               = 401   //未授权
	Forbidden                  = 403   //权限不足
	NotFound                   = 404   //资源未找到
	ServerError                = 500   //服务器内部错误
	UNIVERSAL                  = 666   //通用提示错误
	Validate                   = 10010 //参数校验错误
	ParamsNamesError           = 10011 //参数名称错误
	UsernamePasswordError      = 10012 //账号或者密码错误
	CaptchaError               = 10013 //验证码错误
	CaptchaGetError            = 10014 //验证码获取失败
	UUIDNotNil                 = 10015 //UUID不能为空
	AddError                   = 10016 //添加失败
	DataNotFound               = 10017 //数据不存在
	RefreshTokenErrorOrExpired = 10018 //刷新令牌过期或错误
	FileError                  = 10019 //文件错误
)

//响应码对应描述
var codeText = map[int]string{
	SUCCESS:                    "成功",
	BadRequest:                 "请求错误",
	Unauthorized:               "未授权",
	Forbidden:                  "权限不足、拒绝访问",
	NotFound:                   "资源未找到",
	ServerError:                "服务器内部错误",
	UsernamePasswordError:      "账号或者密码错误",
	Validate:                   "请求参数校验不通过",
	ParamsNamesError:           "参数名称错误",
	CaptchaError:               "验证码错误",
	CaptchaGetError:            "验证码获取失败",
	UUIDNotNil:                 "UUID不能为空",
	DataNotFound:               "数据不存在",
	RefreshTokenErrorOrExpired: "刷新令牌错误或过期",
	FileError:                  "文件错误",
}

// CodeText 获取响应码对应描述
func CodeText(code int) string {
	return codeText[code]
}
